package main

import (
	"api/router"
	"api/util"
	"io"
	"os"
	"github.com/gin-gonic/gin"
)

func main() {
	gin.DisableConsoleColor()

	f, _ := os.Create("gin.log")
	gin.DefaultWriter = io.MultiWriter(f)

	env := util.GetEnv()

	r := router.InitRouter(env)

	if env == "dev" {
		r.Run(":8081")
	} else if env == "test" {
		r.RunTLS(":8080", "./cert/houxue158.com_bundle.crt", "./cert/houxue158.com.key")
	} else if env == "production" {
		r.RunTLS(":8080", "./cert/houxuetang6.cn_bundle.crt", "./cert/houxuetang6.cn.key")
	}
}